import 'package:get/get.dart';

class CommController extends GetxController {
  // 使用 RxList<Map<String, String>> 来观察包含字典的数组的变化
  var items = <Map<String, String>>[
    {
      "title": "Discovering Beauty in Imperfection",
      "value":
          "The days are peaceful, the season has entered winter, without the colorful autumn, but the contours of the mountains and rivers are still clear, with a profound meaning in desolation, giving people hope and aspirations. The afternoon sun is warm and cozy, and the branches and leaves in the courtyard are still the happy home of sparrows, chirping and chirping, as if speaking words of love. The leaves of the elm gently fall in the breeze.",
      "date": "2024/05/23"
    },
    {
      "title": "A Dream of the Red Dust",
      "value":
          "A dream of the red dust, how many flowing clouds outside the window. In the depths of the clouds and smoke, the mist is vast. In the stars and moon, there is my shadow, lingering in the old times, unable to be dispelled. Everything remains the same, only the seasons are in disorder. In the sad place, there is always parting, confusing the clouds and smoke for several times. A dream of prosperity, the years are ruthless, throwing away youth, leaving only scattered clouds.",
      "date": "2024/05/23"
    },
    {
      "title": "Whose Fragrance Shines Brightly",
      "value":
          "April, just entering the rainy season. For some reason, I have always liked lotus flowers. Walking in such a beautiful April, I am full of emotion and enlightenment. My soul has long been dancing gracefully in the soft time, interpreting the most beautiful chapters of life, creating the legend of life in the lingering years, adhering to the vanity in the peaceful season, transcending the soul, and being relieved in it.",
      "date": "2024/05/23"
    },
    {
      "title": "Prose of Happy Mood",
      "value":
          "A good mood can bring us endless happiness. I hope everyone has a happy mood. Below is a collection of Prose of Happy Mood compiled by the editor of Study Abroad Network for your reading. It is for reference only and I hope it will help you. Section one: Prose of Happy Mood Mood is an extension of deep feelings in the heart, it is your unique postcard, you should cherish it well.",
      "date": "2024/05/25"
    },
    {
      "title": "Strolling Prose",
      "value":
          "I like to take a walk alone on the street, the mood is very subtle. Below is a collection of Strolling Prose compiled by the editor of Study Abroad Network for your reading. It is for reference only and I hope it will help you.",
      "date": "2024/05/25"
    },
    {
      "title": "Regaining a Good Mood",
      "value":
          "Occasionally in life, we will encounter setbacks, but we need to regain a good mood as soon as possible. Below is a collection of Regaining a Good Mood compiled by the editor of Study Abroad Network for your reading. It is for reference only and I hope it will help you. Section one: Regaining a Good Mood Life is always full of setbacks and hardships. Sometimes we may be discouraged",
      "date": "2024/05/25"
    },
    {
      "title": "Give the Mood a Break",
      "value":
          "We also need to give our mood a break occasionally, relax ourselves and our mood. Below is a collection of Give the Mood a Break compiled by the editor of Study Abroad Network for your reading. It is for reference only and I hope it will help you.",
      "date": "2024/05/25"
    },
    {
      "title": "The Color of Mood",
      "value":
          "Beautiful mood prose Life is like a simple Chinese question, it requires you to write only one word a day, so accumulated, I once said to someone. It's still an ordinary morning, I heard from my sleep",
      "date": "2024/05/25"
    },
    {
      "title": "Tea Fragrance, Woman and Flowers",
      "value":
          "In the quiet afternoon, sunlight shines through the gauze window, warm and comfortable. I lie diagonally on the bamboo chair, closing my eyes and taking a nap, a cup of fragrant tea in my hand, tasting slowly, elegant and sweet.",
      "date": "2024/05/25"
    }
  ].obs;

  // 添加一个项目到数组
  void addItem(Map<String, String> item) {
    // items.add(item);

    // 将新项目插入到列表的开头
    items.insert(0, item);
  }

  // 移除数组中的一个项目
  void removeItem(Map<String, String> item) {
    items.remove(item);
  }
}
